<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 	xmlns="http://www.w3.org/1999/xhtml" 
		xmlns:ui="http://java.sun.com/jsf/facelets" 
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core" 
		xmlns:p="http://primefaces.org/ui" 
		xmlns:pe="http://primefaces.org/ui/extensions" >
<h:body>
	<p:dialog widgetVar="membershipUpdateDialogWidget"
			id="membershipUpdateDialogId" height="550" width="500" header="Update Membership Package"
			closable="true" draggable="true" resizable="false" modal="true" appendToBody="true">
			<h:form id="UpdateMembershipForm" >
			<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />  
			<p:panel id="panel" header="Update Membership Package">  
				
					<h:panelGrid columns="3">  
					    <h:outputLabel for="name" value="Name: *" />  
					    <p:inputText id="name" value="#{membershipMB.membership.name}" required="true" label="Name" maxlength="100" >
					    	<f:validator validatorId="MembershipNameValidator"/>
					    </p:inputText>
					    <p:message id="nameMsg" for="name" display="default" />  
					
					    <h:outputLabel for="desc" value="Description: *" />  
					    <p:inputTextarea id="desc" value="#{membershipMB.membership.description}" label="description" maxlength="500" rows="5" cols="30"> 
					    </p:inputTextarea >
					    <p:message id="descMsg" for="desc" display="default" /> 
					    
						<h:outputLabel for="price" value="Price: *" />  
					    <pe:inputNumber id="price" value="#{membershipMB.membership.price}" required="true" label="price" maxlength="10">  
            			</pe:inputNumber>  
					    <p:message id="priceMsg" for="price" display="default" /> 			     
	
						<h:outputLabel for="monthValidity" value="Month Validity: *" />  
					    <p:inputText id="monthValidity" value="#{membershipMB.membership.monthValidity}" required="true" label="monthValidity" maxlength="10" mask="99"> 
					    </p:inputText>
					    <p:message id="monthValidityMsg" for="monthValidity" display="default" /> 
					    
					    <h:outputLabel for="effectiveFrom" value="Effective From: *" />  
					    <p:calendar id="effectiveFrom" binding="#{effectiveFromBinding}" value="#{membershipMB.membership.effectiveFrom}" navigator="true" display="inline" label="effectiveFrom">
					    	<f:validator validatorId="MembershipValidityFromValidator"/>
					    	<f:attribute name="effectiveToAtt" value="#{effectiveToBinding}" />
					    </p:calendar>  
					    <p:message id="effectiveFromMsg" for="effectiveFrom" display="default" />  
			
					    <h:outputLabel for="effectiveTo" value="Effective To: *" />  
					    <p:calendar id="effectiveTo" binding="#{effectiveToBinding}" value="#{membershipMB.membership.effectiveTo}" navigator="true" display="inline" label="effectiveTo">
					    	<f:validator validatorId="MembershipValidityToValidator"/>
					    	<f:attribute name="effectiveFromAtt" value="#{effectiveFromBinding}" />
					    </p:calendar>  
					    <p:message id="effectiveToMsg" for="effectiveTo" display="default" />  			
					    
						<h:outputLabel for="renewable" value="Renewable: *" />  
							<p:selectOneMenu id="renewable" value="#{membershipMB.membership.renewable}">  
					            <f:selectItem itemLabel="Yes" itemValue="true" />  
					            <f:selectItem itemLabel="No" itemValue="false" />  
					        </p:selectOneMenu> 
					    <p:message id="renewableMsg" for="renewable" display="default" />				    
					
					</h:panelGrid> 
					
					
					
					<p:commandButton id="btnSave" value="Update" update=":membershipList:membershipTable" action="#{membershipMB.updateMembership}"
					oncomplete="closeDialogIfSucess(xhr, status, args, membershipUpdateDialogWidget, 'membershipUpdateDialogId')" />  
				
			</p:panel>
			</h:form>
		</p:dialog>	
</h:body>
</html>